package testing;

import hypeerweb.*;
import static org.junit.Assert.*;
import org.junit.Test;

public class HyPeerWebTest {

	@Test
	public void testReload() {
		HyPeerWeb hypeerweb = HyPeerWeb.getSingleton();

		hypeerweb.reload("temporary.db");
		hypeerweb.clear();
		hypeerweb.reload();
		hypeerweb.reload("temporary.db");
		assert (hypeerweb.size() == 0);
	}

	@Test
	public void testAdd() {
		HyPeerWeb hypeerweb = HyPeerWeb.getSingleton();

		int size = hypeerweb.size();

		hypeerweb.addNode(Node.NULL_NODE);

		assert (hypeerweb.size() == size + 1);
	}

	@Test
	public void testRemove() {
		HyPeerWeb hypeerweb = HyPeerWeb.getSingleton();

		int size = hypeerweb.size();

		assert (hypeerweb.size() == size);
	}

	@Test
	public void testClear() {
		HyPeerWeb hypeerweb = HyPeerWeb.getSingleton();


		assert (hypeerweb.size() == 0);
	}

}
